from typing import List, Tuple, Dict
from pydantic import BaseModel, validator

class ClassificationCode(BaseModel):
    """行业分类编码模型"""
    code: str
    name: str

    @validator('code')
    def validate_code_format(cls, v):
        if not re.match(r'^[A-Z]?\d{1,4}$', v):
            raise ValueError(f"非法分类编码格式: {v}")
        return v

class CaseData(BaseModel):
    """税务案例数据模型"""
    案例名称: str
    经营范围: str
    常见误判: Dict[str, List[ClassificationCode]]
    正确分类: Dict[str, ClassificationCode]
    语义差异点: Dict[str, List[str]]
    技术处理: Dict
